package com.ft.f_springboot_route.mapper;


import com.ft.f_springboot_route.bean.Route;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface RouteMapper {

    List<Route> selectRouteList(@Param("titleName") String titleName, @Param("currentPage") Integer currentPage);

    @Select("select * from route")
    List<Route> toRouteList();

    Route selectRoute(Integer routeId);

    @Insert("insert into route values(0,#{title},#{subheading},#{price},#{coverSrc},#{istheme},#{shopId},NOW(),#{cateId})")
    void addRoute(Route route);

    @Update("update route set title=#{title},subheading=#{subheading},price=#{price},cover_src=#{coverSrc},istheme=#{istheme},shop_id=#{shopId},create_time=NOW(),cate_id=#{cateId} where route_id=#{routeId}")
    void editRoute(Route route);

    @Delete("delete from route where route_id=#{routeId}")
    void deleteRoute(Integer routeId);

    Long getTotal(@Param("titleName") String titleName);

}
